package com.bobo.serviceorder.controller;

import com.bobo.serviceorder.dao.TbOrderDao;
import com.bobo.serviceorder.entry.TbOrder;
import com.codingapi.txlcn.tc.annotation.TxcTransaction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author bobo
 * @date 2021-04-07
 */
@RestController
public class OrderController {
    @Autowired
    private TbOrderDao tbOrderDao;

    @GetMapping("/order")
    @TxcTransaction
    public String order() {
        TbOrder tbOrder = new TbOrder();
        tbOrder.setId(1);
        tbOrder.setType(1);
        tbOrderDao.insert(tbOrder);
        return "success";
    }
}
